//package com.cloud.jgrapht;
//
//import org.jgrapht.DirectedGraph;
//import org.jgrapht.graph.DefaultDirectedGraph;
//import org.jgrapht.graph.DefaultEdge;
//import org.jgrapht.graph.DirectedSubgraph;
//
//import java.util.HashSet;
//import java.util.Set;
//
//public class GraphConnDemo1
//{
//    private DirectedGraph<String, DefaultEdge> directedGraph;
//    private DirectedGraph<String, DefaultEdge> directedSubGraph;
//
//    public GraphConnDemo1(){
//        directedGraph = new DefaultDirectedGraph<String, DefaultEdge>(DefaultEdge.class);
//        directedGraph.addVertex("a");
//        directedGraph.addVertex("b");
//        directedGraph.addVertex("c");
//        directedGraph.addVertex("d");
//        directedGraph.addVertex("e");
//        directedGraph.addVertex("f");
//        directedGraph.addVertex("h");
//        directedGraph.addVertex("i");
//        directedGraph.addEdge("a", "b");
//        directedGraph.addEdge("b", "c");
//        directedGraph.addEdge("c", "d");
//        directedGraph.addEdge("d", "a");
//        directedGraph.addEdge("c", "e");
//        directedGraph.addEdge("f", "h");
//        directedGraph.addEdge("f", "i");
//    }
//
//    public void subGraph() {
//        Set<String> subNode = new HashSet<String>();
//        subNode.add("a");
//        subNode.add("d");
//        subNode.add("c");
//        subNode.add("f");
//        directedSubGraph = new DirectedSubgraph(directedGraph, subNode);
//        System.out.println(directedSubGraph.vertexSet());
//        System.out.println(directedSubGraph.edgeSet());
//
//    }
//
//    public static void main(String args[])
//    {
//        GraphConnDemo test = new GraphConnDemo();
//        test.subGraph();
//    }
//}
